﻿function layer_show(type, title, url, w, h, offset) {
    if (type == '' || type == 0) {
        type = 2;
    }
    if (title == null || title == '') {
        title = false;
    };
    if (url == null || url == '') {
        url = "404.html";
    };
    if (w == null || w == '') {
        w = ($(window).width() - 50);
    };
    if (h == null || h == '') {
        h = ($(window).height() - 50);
    };
    if (offset == null || offset == "") {
        offset = 'auto'
    }

    //var index =
    layer.open({
        type: type,
        area: [w + '', h + ''],
        fix: true, //不固定
        shadeClose: true,
        shade: 0.8,
        offset: offset,
        title: title,
        content: url
    });

    //layer.full(index);
}
/*关闭弹出框口*/
function layer_close() {
    var index = parent.layer.getFrameIndex(window.name);
    parent.layer.close(index);
}
/*处理lauyi 日期函*/
function formatDate(dt) {
    var year = dt.getYear();
    var month = dt.getMonth() + 1;
    var date = dt.getDate();
    var hour = dt.getHours();
    var minute = dt.getMinutes();
    var second = dt.getSeconds();
    return year + "-" + month + "-" + date + " " + hour + ":" + minute + ":" + second;
}

/*多行检测*/
function CheckMultiple(len, layer, tip) {
    if (len == 0) {
        layer.msg('请选中' + tip + '行', { icon: 2, time: 2000 });
        return false;
    }
    return true;
}
/*单行检测*/
function CheckSingle(len, layer) {
    switch (len) {
        case 0: layer.msg("请选择要操作行！！", { icon: 2, time: 2000 }); break;
        case 1: return true;
        default: layer.msg("只允许选择一行", { icon: 2, time: 2000 }); break;
    }
    return false;
}
/*获取IDList*/
function GetIdList(data) {
    var IdList = "", douhao = "";
    for (var i = 0; i < data.length; i++) {
        IdList += douhao + data[i].ID; douhao = ',';
    }
    return IdList;
}